package com.scsj.cloud.producer.service;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.scsj.cloud.producer.constants.RabbitmqConstant;
import com.scsj.cloud.producer.data.model.WorkOrder;

@Service
public class WorkOrderService {
	
	@Autowired
	private RabbitTemplate rabbitTemplate;
	

	/**
	 * @D 通过 rabbitMQ 发送消息的具体实现
	 * @param workOrder
	 */
	public void sendMsg(WorkOrder workOrder) {
		
		CorrelationData correlationData = new CorrelationData(workOrder.getId());
		
		rabbitTemplate.convertAndSend(RabbitmqConstant.MSG_EXCHANGE, RabbitmqConstant.MSG_ROUTE_KEY, workOrder, correlationData);
	}
	
	
	
	
	

}
